﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.Data.DbUtils.DataMapping;
using PMS.Data.Entities.Customers;

namespace PMS.Data.EntityMap.Customers
{
    /// <summary>
    /// Represents a customer customer role mapping entity builder
    /// </summary>
    public partial class CustomerCustomerRoleMappingMap : PMSEntityTypeConfiguration<CustomerCustomerRoleMapping>
    {
        #region Methods

        /// <summary>
        /// Apply entity configuration
        /// </summary>
        /// <param name="table">Create table expression builder</param>
        public override void Configure(EntityTypeBuilder<CustomerCustomerRoleMapping> builder)
        {
            builder.ToTable("customer_customerrole_mapping");
            builder.HasKey(mapping => new { mapping.CustomerId, mapping.CustomerRoleId });
            builder.Property(mapping => mapping.CustomerId).HasColumnName("Customer_Id");
            builder.Property(mapping => mapping.CustomerRoleId).HasColumnName("CustomerRole_Id");
            builder.Ignore(mapping => mapping.Id);
            builder.Ignore(mapping => mapping.IsActive);
            builder.Ignore(mapping => mapping.CreatedOnTimeUtc);
            builder.Ignore(mapping => mapping.UpdatedOnTimeUtc);
            base.Configure(builder);
        }

        #endregion
    }

}
